package com.zhiwen.design.factory.easy;

import com.zhiwen.design.factory.Add;
import com.zhiwen.design.factory.Arithmetic;
import com.zhiwen.design.factory.Delete;
import com.zhiwen.design.factory.Divide;
import com.zhiwen.design.factory.Multiply;

/**
 * @Auther: wuzhiwen
 * @Date: 2018/12/4 09:53
 * @Description:
 */
public class EasyFactory {
    public static Arithmetic getWayToArith(char ways) {
        //jdk8不支持字符串
        switch (ways) {
            case '+':
                return new Add();
            case '-':
                return new Delete();
            case '*':
                return new Multiply();
            case '/':
                return new Divide();
            default:
                return null;
        }
    }
}
